home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Examples / Draw / Include / PaletteFacet.h < prev    next >
Encoding:
Text File  |  1994-04-21  |  2.5 KB  |  87 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                            PaletteFacet.h
  4. //    Release Version:    $ 1.0d1 $
  5. //
  6. //    Author:                        Henri Lamiraux
  7. //    Creation Date:        3/28/94
  8. //
  9. //    Copyright:    © 1993, 1994 by Apple Computer, Inc., all rights reserved.
  10. //
  11. //========================================================================================
  12.  
  13. #ifndef PALETTEFACET_H
  14. #define PALETTEFACET_H
  15.  
  16. #ifndef DRAWPART_H
  17. #include "DrawPart.h"
  18. #endif
  19.  
  20. // ----- Framework Includes -----
  21.  
  22. #ifndef FWFACET_H
  23. #include "FWFacet.h"
  24. #endif
  25.  
  26. // ----- Graphic Includes -----
  27.  
  28. #ifndef FWRECT_H
  29. #include "FWRect.h"
  30. #endif
  31.  
  32. // ----- Macintosh Includes -----
  33.  
  34. #if defined(FW_BUILD_MAC) && !defined(__QUICKDRAW__)
  35. #include <QuickDraw.h>
  36. #endif
  37.  
  38. //==============================================================================
  39. // Constants
  40. //==============================================================================
  41.  
  42. //==============================================================================
  43. // Forward Declaration
  44. //==============================================================================
  45.  
  46. class CDrawPart;
  47. class FW_CGraphicContext;
  48. class FW_CColor;
  49.  
  50. //==============================================================================
  51. // CPaletteFacet
  52. //==============================================================================
  53.  
  54. class CPaletteFacet : public FW_CFacet
  55. {
  56. //------------------------------------------------------------------------------
  57. // Initialization/destruction
  58. //------------------------------------------------------------------------------
  59. public:
  60.     CPaletteFacet();
  61.     void InitPaletteFacet(XMPFacet* facet, CDrawPart* drawPart);
  62.     virtual ~CPaletteFacet();
  63.  
  64. //------------------------------------------------------------------------------
  65. // Inherited
  66. //------------------------------------------------------------------------------
  67. public:    
  68.     virtual void             Draw(FW_CGraphicContext *gc);
  69.  
  70.     virtual FW_Boolean        DoMouseDown(const FW_CPoint& where,
  71.                                          XMPEventData event);
  72.     
  73. //------------------------------------------------------------------------------
  74. // New API
  75. //------------------------------------------------------------------------------
  76. private:
  77.     void                                GetColor(short colorIndex, FW_CColor* color) const;
  78.     short                        CalcIndex(const FW_CPoint& where) const;
  79.  
  80. //------------------------------------------------------------------------------
  81. // Data
  82. //------------------------------------------------------------------------------
  83. private:
  84.     CDrawPart*                fDrawPart;
  85.     CTabHandle                fColorTable;
  86. };
  87. #endif